package cn.dust.design.pattern.structural.facade;

/**
 * @Author: dust
 * @Date: 2019/11/26 19:02
 */
public class GiftExchangeService {
    private QualifyService qualifyService=new QualifyService();
    private PointsPaymentService pointsPaymentService=new PointsPaymentService();
    private ShippingService shippingService=new ShippingService();

    public GiftExchangeService() {
    }

    public String giftExchangeService(PointsGift pointsGift) {
        if(qualifyService.isAvailable(pointsGift)){
            if(pointsPaymentService.pay(pointsGift)){
                String shippingOrderNo=shippingService.shipGift(pointsGift);
                System.out.println("物流系统下单成功，订单号是"+shippingOrderNo);
                return shippingOrderNo;
            }
        }
        return "下单失败";
    }
}
